package GUI;

import javax.swing.JPanel;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.SystemColor;
import java.awt.Font;
import javax.swing.JLabel;

import Client.BusinessImplements;

import java.awt.Color;
import javax.swing.UIManager;
import javax.swing.border.MatteBorder;
import javax.swing.border.LineBorder;
/**
  * @author Lucie
 * Class name  Managment_choice_panel
 * extend  Abstract_Jpanel
 * purpose: this panel have buttons each of which connects to another screen
 */
public class Managment_choice_panel extends Abstract_Jpanel {

	JButton btndeatails_update;
	JButton btnUpdateReaderCard;
	JButton btnAddACopy;
	JButton btnUpdateBookDeatails ;
	JButton btnWorkersDeatails;
	JButton btnAddNewMemmber;
	JButton btnaddNewItem ;
	private JLabel lblMemmbers;
	private JLabel lblItems;
	private JLabel lblManagmentPanet;
	private JPanel panel_3;
	private JPanel panel_4;
	private JButton btnUpdateeXistenAuthor;
	private JButton btnNewButton;
	private JButton btnNewButton_1;
	private JButton btnNewButton_2;
	private JLabel lblAuthors;
	private JLabel lblSubject;
	private JPanel panel_6;
	private JLabel lblWorkers;
	private JButton btnDeleteMemmber;
	private JButton btnAddUser;
	private JButton btnUpdateUser;
	
	/**
	 * Create the panel.
	 */
	public Managment_choice_panel() {
		setLayout(null);
		
		JPanel panel = new JPanel();
		panel.setBorder(new LineBorder(SystemColor.activeCaption, 6));
		panel.setBackground(SystemColor.inactiveCaption);
		panel.setBounds(10, 49, 1134, 567);
		add(panel);
		panel.setLayout(null);
		  btnaddNewItem = new JButton("add new item");
		  btnaddNewItem.addActionListener(new ActionListener() {
		  	public void actionPerformed(ActionEvent e) {
		  		
		  		Managment_panel mangment_panel=new Managment_panel();
		  		on_screen_unload();
		  		BusinessImplements.GetInstance().getMainFrame().setContentPane(mangment_panel.new_item);
				mangment_panel.new_item.setSize(getMaximumSize());
				mangment_panel.new_item.on_screen_load();
		  		
		  		
		  	}
		  });
		  btnUpdateBookDeatails = new JButton("update item deatails");
		 
		 JPanel panel_2 = new JPanel();
		 panel_2.setBorder(new MatteBorder(3, 3, 3, 3, (Color) SystemColor.control));
		 panel_2.setBackground(SystemColor.activeCaptionBorder);
		 panel_2.setBounds(417, 36, 254, 238);
		 panel.add(panel_2);
		 panel_2.setLayout(null);
		  
	
		 
		 
		  btnaddNewItem.setBounds(32, 28, 168, 32);
		  panel_2.add(btnaddNewItem);
		  btnaddNewItem.setFont(new Font("Tahoma", Font.PLAIN, 14));
		  
		 
		  btnUpdateBookDeatails.setBounds(32, 97, 169, 32);
		  panel_2.add(btnUpdateBookDeatails);
		  btnUpdateBookDeatails.setFont(new Font("Tahoma", Font.PLAIN, 14));
		  
		  JButton btnDeleteItem = new JButton("delete item");
		  btnDeleteItem.addActionListener(new ActionListener() {
		  	public void actionPerformed(ActionEvent e) {
		  		Delete_item_Panel next_screen=new Delete_item_Panel();
		  		on_screen_unload();
		  		BusinessImplements.GetInstance().getMainFrame().setContentPane( next_screen);
		  		next_screen.setSize(getMaximumSize());
		  		next_screen.on_screen_load();
		  		
		  		
		  	}
		  });
		  btnDeleteItem.setBounds(32, 164, 169, 32);
		  panel_2.add(btnDeleteItem);
		  btnDeleteItem.setFont(new Font("Tahoma", Font.PLAIN, 14));
		  
		  lblMemmbers = new JLabel("Members");
		  lblMemmbers.setForeground(new Color(148, 0, 211));
		  lblMemmbers.setFont(new Font("MV Boli", Font.BOLD, 20));
		  lblMemmbers.setBounds(105, 11, 126, 26);
		  panel.add(lblMemmbers);
		  
		  lblItems = new JLabel("Items");
		  lblItems.setForeground(new Color(148, 0, 211));
		  lblItems.setFont(new Font("MV Boli", Font.BOLD, 20));
		  lblItems.setBounds(512, 11, 87, 26);
		  panel.add(lblItems);
		  
		  panel_3 = new JPanel();
		  panel_3.setBorder(new LineBorder(SystemColor.control, 3));
		  panel_3.setBackground(new Color(173, 216, 230));
		  panel_3.setBounds(36, 315, 254, 238);
		  panel.add(panel_3);
		  panel_3.setLayout(null);
		  
		  JButton btnaddNewAuthor = new JButton("add new author");
		  btnaddNewAuthor.addActionListener(new ActionListener() {
		  	public void actionPerformed(ActionEvent e) {
		  		Add_new_author next_screen= new Add_new_author();
		  		
		  		on_screen_unload();
				BusinessImplements.GetInstance().getMainFrame().setContentPane( next_screen);
				next_screen.setSize(getMaximumSize());
				next_screen.on_screen_load();
		  		
		  		
		  	}
		  });
		  btnaddNewAuthor.setFont(new Font("Tahoma", Font.PLAIN, 14));
		  btnaddNewAuthor.setBounds(39, 28, 169, 32);
		  panel_3.add(btnaddNewAuthor);
		  
		  JButton btnDeletedAuthor = new JButton("delete author");
		  btnDeletedAuthor.setFont(new Font("Tahoma", Font.PLAIN, 14));
		  btnDeletedAuthor.setBounds(39, 160, 169, 32);
		  panel_3.add(btnDeletedAuthor);
		  
		  btnUpdateeXistenAuthor = new JButton("update author");
		  btnUpdateeXistenAuthor.addActionListener(new ActionListener() {
		  	public void actionPerformed(ActionEvent e) {
		  		
		  		Update_Author_Panel_first up_authors=new Update_Author_Panel_first();

				on_screen_unload();
				BusinessImplements.GetInstance().getMainFrame().setContentPane(  up_authors);
				 up_authors.setSize(getMaximumSize());
				 up_authors.on_screen_load();
		  	}
		  });
		  
		  btnUpdateeXistenAuthor.setFont(new Font("Tahoma", Font.PLAIN, 14));
		  btnUpdateeXistenAuthor.setBounds(39, 93, 169, 32);
		  panel_3.add(btnUpdateeXistenAuthor);
		  btnDeletedAuthor.addActionListener(new ActionListener() {
		  	public void actionPerformed(ActionEvent e) {
		  		Delete_Autho_Panel next_screen=new Delete_Autho_Panel();
		  		on_screen_unload();
				BusinessImplements.GetInstance().getMainFrame().setContentPane( next_screen);
				next_screen.setSize(getMaximumSize());
				next_screen.on_screen_load();
		  		
		  		
		  		
		  	}
		  });
		  
		  JPanel panel_1 = new JPanel();
		  panel_1.setBorder(new MatteBorder(3, 3, 3, 3, (Color) SystemColor.controlHighlight));
		  panel_1.setBounds(36, 36, 254, 238);
		  panel.add(panel_1);
		  panel_1.setBackground(SystemColor.activeCaption);
		  panel_1.setLayout(null);
		  
		  btnAddNewMemmber = new JButton("add new member");
		  btnUpdateReaderCard = new JButton("update reader card");
		  
		  
		  btnAddNewMemmber.addActionListener(new ActionListener() {
		  	public void actionPerformed(ActionEvent arg0) {
		  		Managment_panel mangment_panel=new Managment_panel();
		  		on_screen_unload();
		  		BusinessImplements.GetInstance().getMainFrame().setContentPane(mangment_panel.new_memmber);
				mangment_panel.new_memmber.setSize(getMaximumSize());
				mangment_panel.new_memmber.on_screen_load();
		  		
		  		
		  		
		  	}
		  });
		  btnAddNewMemmber.setBounds(42, 30, 169, 32);
		  panel_1.add(btnAddNewMemmber);
		  btnAddNewMemmber.setFont(new Font("Tahoma", Font.PLAIN, 14));
		  
		 
		  btnUpdateReaderCard.setBounds(42, 97, 169, 32);
		  panel_1.add(btnUpdateReaderCard);
		  btnUpdateReaderCard.setFont(new Font("Tahoma", Font.PLAIN, 14));
		  
		  panel_4 = new JPanel();
		  panel_4.setBorder(new LineBorder(SystemColor.control, 3));
		  panel_4.setBackground(SystemColor.scrollbar);
		  panel_4.setBounds(417, 315, 254, 238);
		  panel.add(panel_4);
		  panel_4.setLayout(null);
		  
		  btnNewButton = new JButton("add new Subject");
		  
		  btnNewButton.addActionListener(new ActionListener() {
		  	public void actionPerformed(ActionEvent e) {
		  		
		  		Add_NewSubject_panel next_screen=new Add_NewSubject_panel();
		  		on_screen_unload();
				BusinessImplements.GetInstance().getMainFrame().setContentPane( next_screen);
				next_screen.setSize(getMaximumSize());
				next_screen.on_screen_load();
		  		
		  		
		  	}
		  });
		  btnNewButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
		  btnNewButton.setBounds(33, 29, 181, 33);
		  panel_4.add(btnNewButton);
		  
		  btnNewButton_1 = new JButton("delete subject");
		  btnNewButton_1.addActionListener(new ActionListener() {
		  	public void actionPerformed(ActionEvent e) {
		  	
		  		Delete_Subject_Panel next_screen=new Delete_Subject_Panel();
		  		on_screen_unload();
				BusinessImplements.GetInstance().getMainFrame().setContentPane( next_screen);
				next_screen.setSize(getMaximumSize());
				next_screen.on_screen_load();
		  		
		  		
		  	}
		  });
		  btnNewButton_1.setFont(new Font("Tahoma", Font.PLAIN, 14));
		  btnNewButton_1.setBounds(33, 156, 181, 33);
		  panel_4.add(btnNewButton_1);
		  
		  btnNewButton_2 = new JButton("update subject");
		  btnNewButton_2.addActionListener(new ActionListener() {
		  	public void actionPerformed(ActionEvent e) {
		  		
		  		Update_Subject_Panel_first next_screen=new Update_Subject_Panel_first();
		  		on_screen_unload();
				BusinessImplements.GetInstance().getMainFrame().setContentPane( next_screen);
				next_screen.setSize(getMaximumSize());
				next_screen.on_screen_load();
		  	}
		  });
		  btnNewButton_2.setFont(new Font("Tahoma", Font.PLAIN, 14));
		  btnNewButton_2.setBounds(33, 95, 181, 33);
		  panel_4.add(btnNewButton_2);
		  
		  lblAuthors = new JLabel("Authors");
		  lblAuthors.setForeground(new Color(148, 0, 211));
		  lblAuthors.setFont(new Font("MV Boli", Font.BOLD, 20));
		  lblAuthors.setBounds(105, 285, 116, 19);
		  panel.add(lblAuthors);
		  
		  lblSubject = new JLabel("Subject");
		  lblSubject.setForeground(new Color(148, 0, 211));
		  lblSubject.setFont(new Font("MV Boli", Font.BOLD, 20));
		  lblSubject.setBounds(500, 285, 99, 23);
		  panel.add(lblSubject);
		  
		  JPanel panel_5 = new JPanel();
		  panel_5.setBorder(new LineBorder(SystemColor.control, 3));
		  panel_5.setBackground(new Color(216, 191, 216));
		  panel_5.setBounds(798, 36, 254, 238);
		  panel.add(panel_5);
		  panel_5.setLayout(null);
		  btndeatails_update = new JButton("update copy deatails");
		  btndeatails_update.setBounds(42, 96, 169, 32);
		  panel_5.add(btndeatails_update);
		  btndeatails_update.addActionListener(new ActionListener() {
		  	public void actionPerformed(ActionEvent e) {
		  		Update_Item_Details_Primary up_ite_deatails_pri=new Update_Item_Details_Primary();

				on_screen_unload();
				BusinessImplements.GetInstance().getMainFrame().setContentPane( up_ite_deatails_pri);
				 up_ite_deatails_pri.setSize(getMaximumSize());
				 up_ite_deatails_pri.on_screen_load();
		  		
		  		
		  		
		  	}
		  });
		  btndeatails_update.setFont(new Font("Tahoma", Font.PLAIN, 14));
		  btnAddACopy = new JButton("add a copy");
		  btnAddACopy.setBounds(42, 30, 169, 32);
		  panel_5.add(btnAddACopy);
		  btnAddACopy.setFont(new Font("Tahoma", Font.PLAIN, 14));
		  
		  JButton btnDeleteACopy = new JButton("delete a copy");
		  btnDeleteACopy.addActionListener(new ActionListener() {
		  	public void actionPerformed(ActionEvent e) {
		  		Detete_Copy_first_Panel next_screen=new Detete_Copy_first_Panel();
		  		on_screen_unload();
		  		BusinessImplements.GetInstance().getMainFrame().setContentPane( next_screen);
		  		next_screen.setSize(getMaximumSize());
		  		next_screen.on_screen_load();
		  		
		  		
		  	}
		  });
		  btnDeleteACopy.setBounds(42, 167, 169, 32);
		  panel_5.add(btnDeleteACopy);
		  btnDeleteACopy.setFont(new Font("Tahoma", Font.PLAIN, 14));
		  
		  JLabel lblCopys = new JLabel("Copies");
		  lblCopys.setForeground(new Color(138, 43, 226));
		  lblCopys.setFont(new Font("MV Boli", Font.BOLD, 20));
		  lblCopys.setBounds(887, 13, 87, 23);
		  panel.add(lblCopys);
		  
		  panel_6 = new JPanel();
		  panel_6.setBorder(new LineBorder(SystemColor.control, 3));
		  panel_6.setBackground(new Color(204, 204, 255));
		  panel_6.setBounds(798, 315, 254, 238);
		  panel.add(panel_6);
		  panel_6.setLayout(null);
		  btnWorkersDeatails = new JButton("workers deatails");
		  btnWorkersDeatails.setBounds(44, 195, 169, 32);
		  panel_6.add(btnWorkersDeatails);
		  btnWorkersDeatails.setFont(new Font("Tahoma", Font.PLAIN, 14));
		  
		  btnDeleteMemmber = new JButton("delete User");
		  
		  btnDeleteMemmber.setBounds(44, 86, 169, 32);
		  panel_6.add(btnDeleteMemmber);
		  btnDeleteMemmber.addActionListener(new ActionListener() {
		  	public void actionPerformed(ActionEvent e) {
		  		Delete_User_panel delete_user_controler=new Delete_User_panel();
		  		on_screen_unload();
		  		BusinessImplements.GetInstance().getMainFrame().setContentPane( delete_user_controler);
				delete_user_controler.setSize(getMaximumSize());
				delete_user_controler.on_screen_load();
		  		
		  			
		  		
		  		
		  	}
		  });
		  btnDeleteMemmber.setFont(new Font("Tahoma", Font.PLAIN, 14));
		  
		  btnAddUser = new JButton("add User");
		
		  
		  btnAddUser.addActionListener(new ActionListener() {
		  	public void actionPerformed(ActionEvent e) {
		  		Add_New_User_Panel next_screen=new Add_New_User_Panel();
		  		on_screen_unload();
		  		BusinessImplements.GetInstance().getMainFrame().setContentPane( next_screen);
		  		next_screen.setSize(getMaximumSize());
		  		next_screen.on_screen_load();
		  	}
		  });
		  btnAddUser.setBounds(44, 28, 169, 31);
		  panel_6.add(btnAddUser);
		  btnAddUser.setFont(new Font("Tahoma", Font.PLAIN, 14));
		  
		  btnUpdateUser = new JButton("update user");
		  btnUpdateUser.addActionListener(new ActionListener() {
		  	public void actionPerformed(ActionEvent e) {
		  		
		  		Update_User_first_Panel next_screen=new Update_User_first_Panel();
		  		on_screen_unload();
		  		BusinessImplements.GetInstance().getMainFrame().setContentPane( next_screen);
		  		next_screen.setSize(getMaximumSize());
		  		next_screen.on_screen_load();
		  		
		  		
		  	}
		  });
		  btnUpdateUser.setFont(new Font("Tahoma", Font.PLAIN, 14));
		  btnUpdateUser.setBounds(44, 141, 169, 30);
		  panel_6.add(btnUpdateUser);
		  btnWorkersDeatails.addActionListener(new ActionListener() {
		  	public void actionPerformed(ActionEvent e) {
		  		Managment_panel mangment_panel=new Managment_panel();
		  		on_screen_unload();
		  		BusinessImplements.GetInstance().getMainFrame().setContentPane(mangment_panel.worker_deatails);
				mangment_panel.worker_deatails.setSize(getMaximumSize());
				mangment_panel.worker_deatails.on_screen_load();
		  		
		  	}
		  });
		  
		  lblWorkers = new JLabel("Workers");
		  lblWorkers.setForeground(new Color(138, 43, 226));
		  lblWorkers.setFont(new Font("MV Boli", Font.BOLD, 20));
		  lblWorkers.setBounds(887, 285, 116, 19);
		  panel.add(lblWorkers);
		  
		  lblManagmentPanet = new JLabel("Managment Panel");
		  lblManagmentPanet.setBounds(25, 11, 418, 37);
		  add(lblManagmentPanet);
		  lblManagmentPanet.setForeground(new Color(25, 25, 112));
		  lblManagmentPanet.setFont(new Font("MV Boli", Font.BOLD, 30));
		  btnAddACopy.addActionListener(new ActionListener() {
		  	public void actionPerformed(ActionEvent e) {
		  		Finding_Item_To_Add_copy_Of_It add_copy_first = new Finding_Item_To_Add_copy_Of_It ();
		  		on_screen_unload();
		  		BusinessImplements.GetInstance().getMainFrame().setContentPane(add_copy_first);
				add_copy_first.setSize(getMaximumSize());
				add_copy_first.on_screen_load();
		  		
		  		
		  		
		  		
		  	}
		  });
		  btnUpdateReaderCard.addActionListener(new ActionListener() {
		  	public void actionPerformed(ActionEvent arg0) {
		  		
		  		Update_Member_Card_Primary up_memmber_card_pri=new Update_Member_Card_Primary();
		  		on_screen_unload();
		  		BusinessImplements.GetInstance().getMainFrame().setContentPane( up_memmber_card_pri);
				up_memmber_card_pri.setSize(getMaximumSize());
				up_memmber_card_pri.on_screen_load();
		  		
		  		
		  		
		  		
		  		
		  	}
		  });
		  btnUpdateBookDeatails.addActionListener(new ActionListener() {
		  	public void actionPerformed(ActionEvent e) {
		  		
		  		Update_Details_Book_Select_Book update_book_deatails=new Update_Details_Book_Select_Book ();
		  		on_screen_unload();
		  		BusinessImplements.GetInstance().getMainFrame().setContentPane(update_book_deatails);
		  		update_book_deatails.setSize(getMaximumSize());
		  		update_book_deatails.on_screen_load();
		  		
		  		
		  		
		  	}
		  });

	}
	@Override
	public void next_screen() {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void prev_screen() {
		// TODO Auto-generated method stub
		
	}
	@Override
	/**
	 * There are buttons for that the librarian can not access and 
	 * therefore will not be available to her
	 */
	
	
	public void on_screen_load() {
		if (BusinessImplements.GetInstance().getUserLogin().getUserPosition()<3)
		{  btnAddUser.setEnabled(false);
			btnDeleteMemmber.setEnabled(false);
			btnUpdateUser.setEnabled(false);
		}
		
	}
	@Override
	public void on_screen_unload() {
		// TODO Auto-generated method stub
		
	}
}
